From bf368a8c12636ea0a63cc555a0c80b465c62180a Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Sat, 6 Nov 2021 19:15:09 +0100
Subject: [PATCH] musl build

---
 communicate.h   | 3 ---
 configure       | 2 +-
 doc/Makefile.in | 2 +-
 faked.c         | 8 ++++----
 libfakeroot.c   | 9 ++-------
 5 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/communicate.h b/communicate.h
index 3f9ca39..08f82b9 100644
--- a/communicate.h
+++ b/communicate.h
@@ -69,9 +69,6 @@
 	|| (defined __UCLIBC__ && defined __UCLIBC_HAS_LFS__)
 # define STAT64_SUPPORT
 #else
-# ifndef __APPLE__
-#  warning Not using stat64 support
-# endif
 /* if glibc is 2.0 or older, undefine these again */
 # undef STAT64_SUPPORT
 # undef _LARGEFILE64_SOURCE
diff --git a/configure b/configure
index 827fa11..b112240 100644
--- a/configure
+++ b/configure
@@ -13478,7 +13478,7 @@ for SEARCH in %stat f%stat l%stat f%statat %stat64 f%stat64 l%stat64 f%statat64
   FUNC=`echo $SEARCH|sed -e 's/.*%//'`
   PRE=`echo $SEARCH|sed -e 's/%.*//'`
   FOUND=
-  for WRAPPED in __${PRE}x${FUNC} _${PRE}x${FUNC} __${PRE}${FUNC}13 ${PRE}${FUNC}; do
+  for WRAPPED in ${PRE}${FUNC}; do
     for ac_func in $WRAPPED
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 51c4903..68bb799 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -344,7 +344,7 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = foreign
-SUBDIRS = de es fr nl pt sv
+SUBDIRS =
 man_MANS = faked.1 fakeroot.1
 
 #another automake bug workaround
diff --git a/faked.c b/faked.c
index a970184..3223ba3 100644
--- a/faked.c
+++ b/faked.c
@@ -610,11 +610,11 @@ int save_database(const uint32_t remote)
 
 #ifdef FAKEROOT_DB_PATH
     if (find_path(i->buf.dev, i->buf.ino, roots, path))
-      fprintf(f,"mode=%llo,uid=%llu,gid=%llu,nlink=%llu,rdev=%llu %s\n",
+      fprintf(f,"mode=%"PRIo64",uid=%"PRIu64",gid=%"PRIu64",nlink=%"PRIu64",rdev=%"PRIu64" %s\n",
               (uint64_t) i->buf.mode,(uint64_t) i->buf.uid,(uint64_t) i->buf.gid,
               (uint64_t) i->buf.nlink,(uint64_t) i->buf.rdev,path);
 #else
-    fprintf(f,"dev=%llx,ino=%llu,mode=%llo,uid=%llu,gid=%llu,nlink=%llu,rdev=%llu\n",
+    fprintf(f,"dev=%"PRIx64",ino=%"PRIu64",mode=%"PRIo64",uid=%"PRIu64",gid=%"PRIu64",nlink=%"PRIu64",rdev=%"PRIu64"\n",
             (uint64_t) i->buf.dev,(uint64_t) i->buf.ino,(uint64_t) i->buf.mode,
             (uint64_t) i->buf.uid,(uint64_t) i->buf.gid,(uint64_t) i->buf.nlink,
             (uint64_t) i->buf.rdev);
@@ -640,7 +640,7 @@ int load_database(const uint32_t remote)
 
   while(1){
 #ifdef FAKEROOT_DB_PATH
-    r=scanf("mode=%llo,uid=%llu,gid=%llu,nlink=%llu,rdev=%llu "DB_PATH_SCAN"\n",
+    r=scanf("mode=%"PRIo64",uid=%"PRIu64",gid=%"PRIu64",nlink=%"PRIu64",rdev=%"PRIu64" "DB_PATH_SCAN"\n",
             &stmode, &stuid, &stgid, &stnlink, &strdev, &path);
     if (r != 6)
       break;
@@ -655,7 +655,7 @@ int load_database(const uint32_t remote)
     stdev = path_st.st_dev;
     stino = path_st.st_ino;
 #else
-    r=scanf("dev=%llx,ino=%llu,mode=%llo,uid=%llu,gid=%llu,nlink=%llu,rdev=%llu\n",
+    r=scanf("dev=%"PRIx64",ino=%"PRIu64",mode=%"PRIo64",uid=%"PRIu64",gid=%"PRIu64",nlink=%"PRIu64",rdev=%"PRIu64"\n",
             &stdev, &stino, &stmode, &stuid, &stgid, &stnlink, &strdev);
     if (r != 7)
       break;
diff --git a/libfakeroot.c b/libfakeroot.c
index 53c67d3..b511330 100644
--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -81,12 +81,14 @@
 #define SEND_STAT64(a,b,c) send_stat64(a,b,c)
 #define SEND_GET_STAT(a,b) send_get_stat(a,b)
 #define SEND_GET_STAT64(a,b) send_get_stat64(a,b)
+#define SEND_GET_XATTR(a,b,c) send_get_xattr(a,b,c)
 #define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b,c)
 #else
 #define SEND_STAT(a,b,c) send_stat(a,b)
 #define SEND_STAT64(a,b,c) send_stat64(a,b)
 #define SEND_GET_STAT(a,b) send_get_stat(a)
 #define SEND_GET_STAT64(a,b) send_get_stat64(a)
+#define SEND_GET_XATTR(a,b,c) send_get_xattr(a,b)
 #define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b)
 #endif
 
-- 
2.33.1
